home *** CD-ROM | disk | FTP | other *** search
- package kool;
-
- import com.siemens.mp.game.GraphicObject;
- import com.siemens.mp.game.Sprite;
-
- public class Shoot extends Sprite {
- public static final int SPIRAL = 1;
- public static final int BULLET = 2;
- public int type;
- public static int SHOOTTIME = 15;
- public static int SHOOTSPEED = 5;
- private int shootCount = 0;
- private static byte[] shoot1_bin = new byte[]{64, 64, -64, 64, 96, 64, -64, 64, 96, 64, -64, 64, 96, 64, -64, 64, 96, 64, -64, 64, 96, 64, -64, 64, 96, 64, -64, 64, 96, 64, -64, 64, 96, 64, -64, 64, 96, 64, -64, 64, 96, 64, -64, 64, 96, 64, -64, 64};
-
- public Shoot(int type) {
- super(shoot1_bin, 0, 8, 48, shoot1_bin, 0, 1);
- ((Sprite)this).setCollisionRectangle(0, 0, 3, 48);
- this.type = type;
- }
-
- public void fire(Player p) {
- ((Sprite)this).setPosition(((Sprite)p).getXPosition() + 7, ((Sprite)p).getYPosition() - 8);
- ((GraphicObject)this).setVisible(true);
- this.shootCount = 0;
- }
-
- public void move() {
- ((Sprite)this).setPosition(((Sprite)this).getXPosition(), ((Sprite)this).getYPosition() - SHOOTSPEED);
- ++this.shootCount;
- if (this.shootCount > SHOOTTIME) {
- ((GraphicObject)this).setVisible(false);
- }
-
- }
- }
-